<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%
String path = request.getContextPath();
%>
<% 
 /**
  功能名称:批量修改用户信息
  创建时间:2010-10-19
  创建人:
**/
%>
<html>
  <head>
  	<base target="_self">
    <title>批量修改用户信息</title>
	<link href="<%=path %>/css/index_css.css" rel="stylesheet" type="text/css" />
	<script src="<%=path%>/dwr/engine.js"></script>
	<script src="<%=path%>/dwr/util.js"></script>
	<script src="<%=path%>/dwr/interface/shiyueDwr.js"></script>
	<script src="<%=path %>/js/WdatePicker.js"></script>
	<script type="text/javascript">
	window.onload = function() {
   		shiyueDwr.findCodeByCodeMaintenanceTypeId("sex",getSexCallBack);//性别
    }
	    
	
    //性别
    function getSexCallBack(sexMap) {
        <c:forEach items="${requestScope.UserList}" var="per">
        DWRUtil.addOptions("${per.userId}Sex", sexMap);
        if('${per.sex}'!="")
        {
          document.getElementById("${per.userId}Sex").value="${per.sex}";
        }
        </c:forEach>
    }
	    
	var UserIdArr="";
	function doSumbit(){
		document.getElementById('UserIdArr').value=UserIdArr;
		//添加 头像部分
		document.myform.submit();
	}
		
	//获取中英文混合字符串的长度
	function strlen(str) {      
	    var len = 0;      
	    for (var i = 0; i < str.length; i++) {      
	        if (str.charCodeAt(i) > 255 || str.charCodeAt(i)<0) len += 2; else len ++;      
	    }      
	    return len;      
	}
		
		//检测字符长度
     function checkLength(obj,length,str)
     {
       if(strlen(obj.value)>length)
       {
         alert(str+"字数过长");
         obj.value=obj.value.substring(0,length-1);
       }
     }
     
     //单列复制内容功能
     function coptyContext(userId,columnName){
     var firstValue=document.getElementById(userId+columnName+"").value;
     <c:forEach items="${requestScope.UserList}" var="p">
     document.getElementById("${p.userId }"+columnName).value=firstValue;
     </c:forEach>
     }
     
     function checkFiles(obj)
      {
      	if(obj.value!=null) {
      		obj.nextSibling.value="true";
      	}
      }
	</script>
  </head>
  <body>
  <form name="myform" action="<%=path %>/dobatchUpdateUserUserAction.action" method="post" enctype="multipart/form-data">
  <input type="hidden" id="UserIdArr" name="UserIdArr" value="" />
  <table width="1400" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="left" valign="top" bgcolor="#ECE9D8" class="border_2">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align="left" valign="top" class="tb_10 border_2">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td height="25" align="left">正在维护 <span class="f_4">用户信息</span></td>
            </tr>
            <tr>
              <td height="1" align="left" bgcolor="#ACA899"></td>
            </tr>
          </table>
          
          
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
           <td align="left" valign="top">
           <table width="100%" border="0" cellspacing="0" cellpadding="0">
               <tr>
                 <td width="2" height="24" align="left" background="<%=path%>/images/sywesp_21.gif"><img src="<%=path%>/images/sywesp_20.gif" width="2" height="24" /></td>
                 <td align="left" background="<%=path%>/images/sywesp_21.gif">
                 <table width="100%" border="0" cellspacing="0" cellpadding="0">
                     <tr>
                       <td width="6%"></td>
                       
                       <td align="left" class="f_8" width="8%"><img src="<%=path%>/images/sywesp_23.gif" width="8" height="22" align="absmiddle" />姓名</td>
                       <td align="left" class="f_8" width="8%"><img src="<%=path%>/images/sywesp_23.gif" width="8" height="22" align="absmiddle" />密码</td>
                       <td align="left" class="f_8" width="7%"><img src="<%=path%>/images/sywesp_23.gif" width="8" height="22" align="absmiddle" />性别</td>
                       <td align="left" class="f_8" width="9%"><img src="<%=path%>/images/sywesp_23.gif" width="8" height="22" align="absmiddle" />手机号码</td>
                       <td align="left" class="f_8" width="8%"><img src="<%=path%>/images/sywesp_23.gif" width="8" height="22" align="absmiddle" />身份证号</td>
                       <td align="left" class="f_8" width="8%"><img src="<%=path%>/images/sywesp_23.gif" width="8" height="22" align="absmiddle" />电子邮件</td>
                       <td align="left" class="f_8" width="9%"><img src="<%=path%>/images/sywesp_23.gif" width="8" height="22" align="absmiddle" />家庭地址</td>
                       
                     </tr>
                 </table>
                 </td>
                 <td width="4" align="right" background="<%=path%>/images/sywesp_21.gif"><img src="<%=path%>/images/sywesp_22.gif" width="4" height="24" /></td>
               </tr>
           </table>
           </td>
         </tr>
          </table>
          
          
          <!-- 开始 -->
          <c:forEach items="${requestScope.UserList}" var="p" varStatus="num">
          <script>UserIdArr+='${p.userId}'+',';</script>
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
             <td align="left" valign="top">
             <table width="100%" border="0" cellspacing="0" cellpadding="0">
                 <tr>
                   <td height="25" align="left" valign="top" class="tb_7">
                   <table width="100%" border="0" cellspacing="1" cellpadding="0">
                       <tr>
                         <td align="left" valign="bottom" width="6%">
                         <table width="100%"><tr>
			              <td width="50%" height="25" nowrap="nowrap"><img src="<%=path%>/images/icon_46.gif" width="14" height="14" /> ${p.userId}</td>
			              <td width="50%" align="right">&nbsp;</td></tr>
			             </table>
                         </td>
                         
                         <td align="left" valign="bottom" width="8%"><input type="text" id="${p.userId }name" name="${p.userId }name" size="10" value="${p.name }" onchange="checkLength(this,50,'姓名');"/><c:if test="${num.count==1}"><img src="<%=path%>/images/xf_sr_56.gif" width="12" height="15" onclick="coptyContext('${p.userId }','name')" /></c:if></td>
                         <td align="left" valign="bottom" width="8%"><input type="password" id="${p.userId }pwd" name="${p.userId }pwd" size="10" value="${p.password }"/><c:if test="${num.count==1}"><img src="<%=path%>/images/xf_sr_56.gif" width="12" height="15" onclick="coptyContext('${p.userId }','pwd')" /></c:if></td>
                         <td align="left" valign="bottom" width="7%"><select id="${p.userId }Sex" name="${p.userId }Sex"><option value=""></option></select><c:if test="${num.count==1}"><img src="<%=path%>/images/xf_sr_56.gif" width="12" height="15" onclick="coptyContext('${p.userId }','Sex')" /></c:if></td>
                         <td align="left" valign="bottom" width="9%"><input id="${p.userId }phone" type="text" size="12" name="${p.userId }phone" value="${p.mobileNumber1 }" onchange="checkLength(this,20,'手机号码');"/><c:if test="${num.count==1}"><img src="<%=path%>/images/xf_sr_56.gif" width="12" height="15" onclick="coptyContext('${p.userId }','phone')" /></c:if></td>
                         <td align="left" valign="bottom" width="8%"><input type="text" id="${p.userId }idNumber" name="${p.userId }idNumber" size="17" value="${p.idNumber }" onchange="checkLength(this,50,'身份证号');"/><c:if test="${num.count==1}"><img src="<%=path%>/images/xf_sr_56.gif" width="12" height="15" onclick="coptyContext('${p.userId }','idNumber')" /></c:if></td>
                         <td align="left" valign="bottom" width="8%"><input type="text" id="${p.userId }email" name="${p.userId }email" size="15" value="${p.email }" onchange="checkLength(this,50,'电子邮件');"/><c:if test="${num.count==1}"><img src="<%=path%>/images/xf_sr_56.gif" width="12" height="15" onclick="coptyContext('${p.userId }','email')" /></c:if></td>
                         <td align="left" valign="bottom" width="9%"><input type="text" id="${p.userId }address" name="${p.userId }address" size="15" value="${p.address }" onchange="checkLength(this,50,'姓名');"/><c:if test="${num.count==1}"><img src="<%=path%>/images/xf_sr_56.gif" width="12" height="15" onclick="coptyContext('${p.userId }','address')" /></c:if></td>
                         
                         </tr>
                   </table></td>
                 </tr>
               </table>
              </td>
           </tr>
          </table>
          </c:forEach>
          
          <!-- 遍历结束 -->
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="25" align="center" valign="bottom"><input type="button" onclick="doSumbit();" name="Submit" value="提 交" /></td>
        </tr>
      </table>
      </td>
  </tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>
